﻿using System;
using System.Collections;
using System.IO;


namespace StringMatch
{
    class Program
    {
        public static void Main(string[] args)
        {
            Int32 yLength = 30;
            Int32 xLength = 5000;

            PrimeTable pt = new PrimeTable(Convert.ToUInt32(2 * xLength * yLength * yLength),
                "prime.1G");

            Console.WriteLine("Start to generate prime table");
            DateTime gen = DateTime.Now;
            Console.WriteLine("Prime table OK. Time: {0}", (DateTime.Now - gen).TotalSeconds);

            StreamWriter writer = new StreamWriter("out.5000.20.csv");

            for (int i = 0; i < 5000; i++)
            {
                Benchmark b = new Benchmark(xLength, yLength, pt);
                var result = b.Run(30);
                writer.WriteLine("{0},{1},{2},{3}",
                    result.KMP.TotalSeconds,
                    result.MonteCarlo.TotalSeconds,
                    result.LasVegas.TotalSeconds,
                    result.IsMonteCarloRight);
                Console.WriteLine(i);
            }
            writer.Close();


        }
    }
}